package com.cooksys.film_rental.dao;

import java.util.List;

import com.cooksys.film_rental.model.Address;
import com.cooksys.film_rental.model.City;
import com.cooksys.film_rental.model.Country;
import com.cooksys.film_rental.model.Customer;
import com.cooksys.film_rental.model.Staff;
import com.cooksys.film_rental.model.Store;

/**
 * Data access object for the {@link Address} class
 * 
 * @author Peter Zastoupil
 * 
 */
public interface AddressDao {

	/**
	 * Saves a given {@link Address} as a record in the database
	 * 
	 * @param address
	 *            the Address to save
	 * @return the {@link Address} that was saved in the database
	 */
	public Address save(Address address);

	/**
	 * Updates the database record associated with the given {@link Address}
	 * 
	 * @param address
	 *            the Address to be updated
	 */
	public void update(Address address);

	/**
	 * Deletes the database record associated with the given {@link Address}
	 * 
	 * @param address
	 *            the CUstomer to be deleted
	 */
	public void delete(Address address);

	/**
	 * 
	 * @param addressId
	 *            the addressId to search by
	 * @return a {@link Address} object that corresponds to the given addressId
	 */
	public Address getAddressByAddressId(Short addressId);

	/**
	 * 
	 * @param city
	 *            the {@link City} to search by
	 * @return a List of {@link Address} objects that corresponds to the given
	 *         city
	 */
	public List<Address> searchAddressesByCity(City city);

	/**
	 * 
	 * @param country
	 *            the {@link Country} to search by
	 * @return a List of {@link Address} objects that corresponds to the given
	 *         country
	 */
	public List<Address> searchAddressesByCountry(Country country);

	/**
	 * 
	 * @param store
	 *            the {@link Store} to search by
	 * @return a {@link Address} object that corresponds to the given store
	 */
	public Address getAddressByStore(Store store);

	/**
	 * 
	 * @param staff
	 *            the {@link Staff} to search by
	 * @return a {@link Address} object that corresponds to the given staff
	 */
	public Address getAddressByStaff(Staff staff);

	/**
	 * 
	 * @param customer
	 *            the {@link Customer} to search by
	 * @return a {@link Address} object that corresponds to the given customer
	 */
	public Address getAddressByCustomer(Customer customer);

	/**
	 * 
	 * @param address
	 *            the {@link Address} to save or update
	 */
	public void saveOrUpdate(Address address);

	/**
	 * 
	 * @param address
	 *            the first line of the address
	 * @param address2
	 *            the second line of the address
	 * @param district
	 *            the district associated with the address
	 * @param phone
	 *            the phone number associated with the address
	 * @param postalCode
	 *            the postalCode associated with the address
	 * @param city
	 *            the {@link City} object associated with the address
	 * @return the {@link Address} object that matches the input values
	 */
	public Address getAddressByInfoAndCity(String address, String address2,
			String district, String phone, String postalCode, City city);

}
